<template>
  <el-menu :default-openeds="['1', '3']" style="min-height: 100%;overflow-x: hidden"
           background-color="rgb(48,65,86)"
           text-color="#fff"
           active-text-color="#ffd04b"
           :collapse-transition="false"
           :collapse="isCollapse"
           router
  >
    <div style="height: 60px;line-height: 60px;text-align: center">
      <img src="../assets/logo.png" style="width: 25px;position: relative;top:6px;margin-right: 5px">
      <b style="color: #ccc" v-show="isShow">Web聊天室</b>
    </div>
    <el-menu-item index="/">
      <i class="el-icon-house"></i>
      <template slot="title">
        <span slot="title">主页</span>
      </template>
    </el-menu-item>
    <el-menu-item index="/onlinechat">
      <i class="el-icon-chat-dot-square"></i>
      <template slot="title">
        <span slot="title">在线聊天</span>
      </template>
    </el-menu-item>
<!--    系统管理仅role=1的用户可见-->
    <el-submenu index="1" v-show="isShowByRole">
      <template slot="title">
        <i class="el-icon-menu"></i>
        <span slot="title">系统管理</span>
      </template>
      <el-menu-item index="/user"><i class="el-icon-user-solid"></i> 用户管理</el-menu-item>
    </el-submenu>
    <el-menu-item index="/about">
      <i class="el-icon-paperclip"></i>
      <template slot="title">
        <span slot="title">关于</span>
      </template>
    </el-menu-item>
  </el-menu>
</template>

<script>
export default {
  name: "Aside",
  props: {
    isCollapse:Boolean,
    isShow:Boolean,
  },
  data(){
    return {
      isShowByRole:false
    }

  },
  created() {
    this.isShowByRole=JSON.parse(localStorage.getItem("user")).role
  }
}
</script>

<style scoped>

</style>